global !p
def floor(i):
	if int(i) == i:
		return i
	elif i > 0:
		return int(i)
	elif i < 0:
		return int(i) - 1

def ceil(i):
	if int(i) == i:
		return i + 1
	elif i > 0:
		return int(i) + 1
	elif i < 0:
		return int(i)

endglobal

snippet func "function" bA
function ${1:funcname}(${2:paramters})
	${3}
endfunction
$0
endsnippet

snippet sect "headings of sections" bwA
"`!p snip.rv = '=' * (37 - floor(len(t[1]) / 2))` ${1:${VISUAL}} `!p snip.rv = '=' * (37 - ceil(len(t[1]) / 2))`"
endsnippet

snippet box "Box" bwA
"+--------------------------------------------------------------------------+" 
"|`!p snip.rv = ' ' * (37 - floor(len(t[1]) / 2))` ${1:${VISUAL}} `!p snip.rv = ' ' * (37 - ceil(len(t[1]) / 2))`|"
"+--------------------------------------------------------------------------+"
$0
endsnippet
